#!/bin/bash

if [ "$2" == 'gn_project' ]; then
    grep -rn -P "(ohos_hap_assist_suite)|(ohos_js_hap_suite)" $(find $1 -name BUILD.gn) | awk -F':' '{print $1}' | sort -u | xargs dirname
elif [ "$2" == 'hvigor_project' ];then
    #find $1 -name hvigor-config.json5 | xargs dirname | xargs dirname
    grep -rn -P "(ohos_app_assist_suite)|(ohos_js_app_suite)" $(find $1 -name BUILD.gn) | grep -v "test/xts/acts/demo/hvigor_sample" | awk -F':' '{print $1}' | sort -u | xargs dirname
else
    exit 1
fi
